home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / BSP Tree 1.2 / Sources / Core / include / widget.h < prev    next >
Encoding:
Text File  |  1995-05-26  |  2.7 KB  |  47 lines  |  [TEXT/MMCC]

  1. //------------------------------------------------------------------------------
  2. //    File:                    widget.h
  3. //    Date:                    7/8/94
  4. //    Author:                Bretton Wade
  5. //
  6. //    Description:    this file contains the class definition for a widget. a
  7. //                                widget is a user interface item that handles clicks and keys
  8. //                                and other forms of interaction.
  9. //
  10. //------------------------------------------------------------------------------
  11.  
  12. #ifndef    WIDGET
  13. #define    WIDGET
  14.  
  15. //------------------------------------------------------------------------------
  16. //    classes
  17. //------------------------------------------------------------------------------
  18. class    widget                                                                                                                                        //    user interface widget class
  19. {                                                                                                                                                                //    begin
  20.     private:                                                                                                                                            //    members internal to this class only
  21.     protected:                                                                                                                                        //    members internal to this class hierarchy
  22.                 widget        *next;                                                                                                                //    pointer to next widget in the list
  23.                 widget        *children;                                                                                                        //    pointer to child widgets
  24.                 widget        *parent;                                                                                                            //    pointer to parent widget
  25.                 bool            enabled;                                                                                                            //    whether or not the widget is enabled
  26.     public:                                                                                                                                                //    members available externally
  27.                 RgnHandle    region;                                                                                                                //    the area that belongs to this widget
  28.                 widget (void);                                                                                                                    //    constructor
  29. virtual    ~widget (void);                                                                                                                    //    destructor
  30. virtual    widget    *AdjustCursor (EventRecord&);                                                                        //    adjust the cursor appropriately
  31. virtual    void        SetCursor (void);                                                                                                //    set the cursor to the correct shape
  32. virtual    void        HandleClick (EventRecord&);                                                                            //    handle mouse down/up
  33. virtual    void        HandleKey (EventRecord&);                                                                                //    handle key press events
  34. virtual    void        Update (EventRecord&);                                                                                    //    update the widget and all of its children
  35. virtual    void        Activate (EventRecord&);                                                                                //    activate/deactivate the widget
  36. virtual    void        Resize (EventRecord&);                                                                                    //    recompute sizing information from parent
  37. virtual    void        AddChild (widget*);                                                                                            //    add a child widget to this one
  38. virtual    widget    *FindWidget (EventRecord&);                                                                            //    return a pointer to the widget that owns the location of the mouse
  39. virtual    void        Enable (bool);                                                                                                    //    set the enable state of the widget
  40. virtual    void        Action (int);                                                                                                        //    an action command
  41. virtual    void        Draw (void);                                                                                                        //    draw the widget
  42. };                                                                                                                                                            //    end
  43.  
  44. //------------------------------------------------------------------------------
  45.  
  46. #endif    //WIDGET
  47.